﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WindowsFormsApplication1
{
    public enum sensor_type { tempture, humidity, shake, door, voltage };
    public enum alarm_type {  high, med, mini, normal};

    public class Monitor_DB
    {

        private static Monitor_DB _instance;
        private Monitor_DB() { }

        public static Monitor_DB instance
        {
            get
            {
                if (_instance == null)
                    _instance = new Monitor_DB();
                return _instance;
            }
        }

        private static MONITOR_DBDataContext _db;
        public MONITOR_DBDataContext db
        {
            get
            {
                if (_db == null)
                    _db = new MONITOR_DBDataContext();

                return _db;
            }
        }

        public void Refresh_DB()
        {
            try
            {
                if (_db != null)
                {
                    _db.Dispose();
                    _db = new MONITOR_DBDataContext();

                }
            }
            catch (Exception ex)
            {

               
            }
        }
    }
}
